Skip to content

Update sonar-check.yml to manage coverage comments - #13878

Merged
DaanHoogland merged 4 commits into
mainfrom
DaanHoogland-patch-7
Aug 15, 2026
Merged

Update sonar-check.yml to manage coverage comments#13878
DaanHoogland merged 4 commits into
mainfrom
DaanHoogland-patch-7

Conversation

@DaanHoogland

Copy link
Copy Markdown
Contributor

Refactor coverage comment handling to update existing comments if present.

Description

This PR...

Types of changes

  • Breaking change (fix or feature that would cause existing functionality to change)
  • New feature (non-breaking change which adds functionality)
  • Bug fix (non-breaking change which fixes an issue)
  • Enhancement (improves an existing feature and functionality)
  • Cleanup (Code refactoring and cleanup, that may add test cases)
  • Build/CI
  • Test (unit or integration test code)

Feature/Enhancement Scale or Bug Severity

Feature/Enhancement Scale

  • Major
  • Minor

Bug Severity

  • BLOCKER
  • Critical
  • Major
  • Minor
  • Trivial

Screenshots (if appropriate):

How Has This Been Tested?

How did you try to break this feature and the system with this change?

Refactor coverage comment handling to update existing comments if present.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR updates the Sonar/coverage GitHub Actions workflow so the “coverage grade” bot comment on pull requests is updated in-place when a prior comment exists, instead of always posting a new comment.

Changes:

  • Adds a hidden marker (<!-- coverage-grade-bot -->) to reliably identify the workflow’s coverage-grade comment.
  • Switches from always creating a PR comment to listing comments and updating an existing matching comment when present.
  • Falls back to creating a new comment when no existing marked comment is found.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread .github/workflows/sonar-check.yml Outdated
@codecov

codecov Bot commented Aug 14, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 19.65%. Comparing base (dbee809) to head (c9ee647).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff            @@
##               main   #13878   +/-   ##
=========================================
  Coverage     19.64%   19.65%           
- Complexity    19784    19795   +11     
=========================================
  Files          6368     6368           
  Lines        574889   574889           
  Branches      70353    70353           
=========================================
+ Hits         112935   112984   +49     
+ Misses       449684   449634   -50     
- Partials      12270    12271    +1     
Flag Coverage Δ
uitests 3.41% <ø> (ø)
unittests 20.92% <ø> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Comment thread .github/workflows/sonar-check.yml Outdated
Copilot AI review requested due to automatic review settings August 14, 2026 13:38

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 1 out of 1 changed files in this pull request and generated no new comments.

Suppressed comments (2)

.github/workflows/sonar-check.yml:115

  • issues.listComments returns only the first page by default (30 comments). On PRs with many comments, the bot’s previous coverage comment may not be in the first page, causing this job to post a duplicate instead of updating. Paginate (or at least increase per_page) and make the marker check resilient to a missing body.
            const { data: comments } = await github.rest.issues.listComments({
              owner:        context.repo.owner,
              repo:         context.repo.repo,
              issue_number: context.issue.number,
            });

.github/workflows/sonar-check.yml:114

  • This step calls issues.listComments, issues.updateComment, and issues.createComment, which require issues permission on GITHUB_TOKEN. The workflow currently only grants contents: read and pull-requests: write, so these API calls can fail with 403 depending on repository default token permissions. Consider explicitly adding issues: write under the workflow/job permissions: block.
            const { data: comments } = await github.rest.issues.listComments({
              owner:        context.repo.owner,
              repo:         context.repo.repo,
              issue_number: context.issue.number,

@Pearl1594 Pearl1594 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

code lgtm

Comment thread .github/workflows/sonar-check.yml Outdated
Copilot AI review requested due to automatic review settings August 15, 2026 10:20

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

Copilot AI review requested due to automatic review settings August 15, 2026 10:48

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@DaanHoogland
DaanHoogland merged commit 1cd2491 into main Aug 15, 2026
25 of 27 checks passed
@DaanHoogland
DaanHoogland deleted the DaanHoogland-patch-7 branch August 15, 2026 11:12
@sonarqubecloud

Copy link
Copy Markdown

@github-actions

Copy link
Copy Markdown

🔴 Test Coverage Grade: D — Marginal

Metric Value
Line coverage 24.51%
Branch coverage 18.67%

Grade Scale

Grade Line Coverage Meaning
🟢 A ≥ 80% Excellent - this code sleeps well at night 😴
🟡 B 60-79% Good - almost there, don't stop now 😉
🟠 C 40-59% Acceptable - your code is wearing a seatbelt, but no airbags 😬
🔴 D 20-39% Marginal - boldly shipping where no test has gone before 🖖
⛔ F < 20% Failing - tests? what tests? 🔥

Branch coverage is shown as a secondary signal. Grade is determined by line coverage.
View full Actions run

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants